package com.sellerSystem.service.Impl;

import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

import javax.annotation.PostConstruct;
import javax.jms.Connection;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.MessageConsumer;
import javax.jms.MessageListener;
import javax.jms.MessageProducer;
import javax.jms.Session;
import javax.jms.TextMessage;
import javax.swing.text.StyleContext.SmallAttributeSet;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.InitBinder;

import com.sellerSystem.dao.SellerDao;
import com.sellerSystem.service.SellerManager;
import com.sellerSystem.vo.Commodity;
import com.sellerSystem.vo.ComplaintInfo;
import com.sellerSystem.vo.Demo;
import com.sellerSystem.vo.OrderForm;
import com.sellerSystem.vo.Seller;
import com.sellerSystem.vo.SellerAddress;
import com.sellerSystem.vo.Temp;

@Service("sm")
public class SellerManagerImpl implements SellerManager {
	@Autowired(required = true)
	private SellerDao sd;

	@Override
	@Transactional
	public int regist(Seller seller) {
		// TODO Auto-generated method stub
		return sd.addSeller(seller);
	}

	@Override
	public Seller login(String sellerTel, String sellerPsd) {
		// TODO Auto-generated method stub

		return sd.findSeller(sellerTel, sellerPsd);
	}

	@Override
	@Transactional
	public int modifyPsd(String sellerTel, String sellerPsd) {
		// TODO Auto-generated method stub
		int rs = sd.modifyPsd(sellerTel, sellerPsd);
		return rs;
	}

	@Override
	public boolean isExist(String sellerTel) {
		// TODO Auto-generated method stub
		return sd.findTel(sellerTel);
	}

	@Override
	@Transactional
	public int addCommodity(Commodity commodity) {
		// TODO Auto-generated method stub
		return sd.addCommodity(commodity);
	}

	@Override
	@Transactional
	public int modifyCommodity(Commodity commodity) {
		// TODO Auto-generated method stub
		return sd.modifyCommodity(commodity);
	}

	@Override
	@Transactional
	public int deleteCommodity(Commodity commodity) {
		// TODO Auto-generated method stub
		int rs = sd.deleteCommodity(commodity);

		return rs;
	}

	@Override
	public Commodity queryCommodity(Integer commodityId) {
		// TODO Auto-generated method stub

		return sd.queryCommodity(commodityId);
	}

	@Override
	public void checkEvaluation() {
		// TODO Auto-generated method stub

	}

	@Override
	public ArrayList<Commodity> findCommodity(String sellerName) {
		// TODO Auto-generated method stub
		return sd.findCommodity(sellerName);
	}

	@Override
	@Transactional
	public ArrayList<Seller> seller(Integer sellerState) {
		// TODO Auto-generated method stub
		return sd.seller(sellerState);
	}

	@Override
	public Seller findId(int sellerId) {
		// TODO Auto-generated method stub
		return sd.findId(sellerId);
	}

	@Override
	public List<OrderForm> allbill() {
		// TODO Auto-generated method stub
		return sd.allbill();
	}

	@Override
	public List<OrderForm> billbyid(String sellerName, String time1,
			String time2) {
		// TODO Auto-generated method stub
		return sd.billbyid(sellerName, time1, time2);
	}

	// 查询个人账单
	public List<OrderForm> billName(String sellerName) {
		return sd.billName(sellerName);
	}

	@Override
	@Transactional
	public int modifystate(Integer sellerId) {
		// TODO Auto-generated method stub
		return sd.modifystate(sellerId);
	}

	@Override
	@Transactional
	public int joinblack(Integer sellerId, String sellerRemark) {
		// TODO Auto-generated method stub
		return sd.joinblack(sellerId, sellerRemark);
	}

	@Override
	public List<ComplaintInfo> findComplaintInfo(Integer sellerId) {
		// TODO Auto-generated method stub
		return sd.findComplaintInfo(sellerId);
	}

	@Override
	public List<Seller> countComplaintInfo() {
		// TODO Auto-generated method stub
		return sd.countComplaintInfo();
	}

	@Override
	public List<Seller> ifBlacklist() {
		// TODO Auto-generated method stub
		return sd.ifBlacklist();
	}

	@Override
	@Transactional
	public int modifyInfo(Seller seller) {
		// TODO Auto-generated method stub
		return sd.modifyInfo(seller);
	}

	@Override
	@Transactional
	public int noblack(Integer sellerId) {
		// TODO Auto-generated method stub
		return sd.noblack(sellerId);
	}

	@Override
	@Transactional
	public int approvalfail(Integer sellerId, String approvalOpinion) {
		// TODO Auto-generated method stub
		return sd.approvalfail(sellerId, approvalOpinion);
	}

	@Override
	public List<ComplaintInfo> complaintInfo() {
		// TODO Auto-generated method stub
		return sd.complaintInfo();
	}

	@Override
	@Transactional
	public int modifyofstate(OrderForm orderForm) {
		// TODO Auto-generated method stub
		return sd.modifyofstate(orderForm);
	}

	@Override
	@Transactional
	public int handlecomplaint(Integer complaintInfoId,Integer complaintStatu,String complaintFeedback) {
		// TODO Auto-generated method stub
		return sd.handlecomplaint(complaintInfoId,complaintStatu,complaintFeedback);
	}

	@Override
	public List<Temp> findBillBySellerIdAndDay(String sellerName) {
		// TODO Auto-generated method stub
		return sd.findBillBySellerIdAndDay(sellerName);
	}

	@Override
	public List<Temp> findBillBySellerIdAndYear(String sellerName) {
		// TODO Auto-generated method stub
		return sd.findBillBySellerIdAndYear(sellerName);
	}

	@Override
	public List<Temp> findBillByDay() {
		// TODO Auto-generated method stub
		return sd.findBillByDay();
	}

	@Override
	public List<Temp> findBillByYear() {
		// TODO Auto-generated method stub
		return sd.findBillByYear();
	}

	@Override
	public List<Temp> findBillBySellerIdAndMonth(String sellerName) {
		// TODO Auto-generated method stub
		return sd.findBillBySellerIdAndMonth(sellerName);
	}

	@Override
	public List<Temp> findBillByMonth() {
		// TODO Auto-generated method stub
		return sd.findBillByMonth();
	}

	@Override
	public List<Demo> billName1(String sellerName) {
		// TODO Auto-generated method stub
		return sd.billName1(sellerName);
	}
}
